﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System;
using System.Collections.Generic;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using VSDBM.Code.functions;
using VSDBM.Code.dto;
using VSDBM.Code.dao;

namespace VSDBM.Code.functions
{
    public class Estrutura
    {
        public static String getMenu(HttpResponse Response)
        {
            VSDBM.Code.dto.User usuariologado = (VSDBM.Code.dto.User)HttpContext.Current.Session["usuariologado"];
         
            //SÓ MANTER ESSE CÓDIGO DURANTE O TESTE.
          //  usuariologado = new dto.User(1,"Admin","admin@vsdbm.com.br","admin",Encryption.CalculateMD5Hash("123"),1,1);
            //-----------FIM AQUI-------------------
            string menu = null;
            if (usuariologado != null)
            {
                try
                {
                    if (usuariologado.acessgroup == 1)
                    {
                        menu = getAdm(usuariologado);
                    }
                    else if (usuariologado.acessgroup == 2)
                    {
                        menu = getCurator(usuariologado);
                    }
                    else if (usuariologado.acessgroup == 3)
                    {
                        menu = getResearcher(usuariologado);
                    }

                    return menu;
                }
                catch (System.NullReferenceException ex)
                {
                    throw;

                }
            }
            else
            {
                Response.Redirect("../../../Default.aspx");
                return "";
            }
        }

        public static string getAdm(Code.dto.User usuariologado)
        {
            String menu = null;
             menu += "<ul> ";
             menu += "<li class='active '> ";
             menu += "<img alt='' src='../../../../../Visual/Imagens/logomarca.png'  width='200px' height='70px'/>";
             menu += "</li> ";
            menu += "<li class='active '> ";
             menu += "<a href='../../../../../Buscador.aspx'><span>Home</span></a>  ";
             menu += "</li> ";
             menu += "<li class='has-sub '> ";
             menu += "<a href='#'><span>Procedures</span></a> ";
             menu += "<ul> ";
             menu += "<li class='has-sub '> ";
             menu += "<a href='../../../../../Visual/Procedures/Subtyping/SequenceSubtyping.aspx'><span>Sequence Subtyping</span></a> ";
             menu += "</li> ";
             menu += "<li class='has-sub '> ";
             menu += "<a href='../../../../../Visual/Procedures/Mapping/SequenceMapping.aspx'><span>Sequence Mapping</span></a> ";
             menu += "</li> ";
             menu += "<li class='has-sub '> ";
             menu += "<a href='../../../../../Visual/Procedures/Blast/BlastNTool.aspx'><span>Blast Tool</span></a> ";
             menu += "</li> ";
             menu += "<li class='has-sub '> ";
             menu += "<a href='../../../../../Visual/Procedures/Alignments/SequenceAlignment.aspx'><span>Sequence Alignment</span></a> ";
             menu += "</li> ";
             menu += "<li class='has-sub '> ";
             menu += "<a href='../../../../../Visual/CRUD/Sequence/ImportSequence.aspx'><span>Import Sequences</span></a> ";
             menu += "</li> ";
             menu += "<li class='has-sub '> ";
             menu += "<a href='../../../../../Visual/CRUD/Sequence/ImportGenBank.aspx'><span>Import From GenBank File</span></a> ";
             menu += "</li> ";
             menu += PluginsDAO.ListToItensmenu(PluginsDAO.DSToList(PluginsDAO.select("", "")));
             menu += "</ul> ";
             menu += "</li> ";
             menu += "<li class='has-sub '> ";
             menu += "<a href='#'><span>Reports</span></a> ";
             menu += "<ul> ";
             menu += "<li class='has-sub '> ";
             menu += "<a href='../../../../../Visual/Procedures/Reports/GeneralMapAndSubReport.aspx'><span>Mapping and Subtyping Report</span></a> ";
             menu += "</li> ";
             menu += "<li class='has-sub '> ";
             menu += "<a href='../../../../../Visual/Procedures/Reports/Sequence_map.aspx'><span>Sequence Map Report</span></a> ";
             menu += "</li> ";
             menu += "<li class='has-sub '> ";
             menu += "<a href='../../../../../Visual/Procedures/Reports/Sequence_subtype.aspx'><span>Sequence Subtyping Report</span></a> ";
             menu += "</li> ";
             menu += "<li class='has-sub '> ";
             menu += "<a href='../../../../../Visual/Procedures/Reports/UserReport.aspx'><span>User Report</span></a> ";
             menu += "</li> ";
             menu += "<li class='has-sub '> ";
             menu += "<a href='../../../../../Visual/Procedures/Reports/GroupReport.aspx'><span>Groups Report</span></a> ";
             menu += "</li> ";
             menu += "<li class='has-sub '> ";
             menu += "<a href='../../../../../Visual/Procedures/Reports/OrganismReport.aspx'><span>Organism Report</span></a> ";
             menu += "</li> ";
             menu += "<li class='has-sub '> ";
             menu += "<a href='../../../../../Visual/Procedures/Reports/SequencesReport.aspx'><span>Sequences Report</span></a> ";
             menu += "</li> ";
             menu += "</ul> ";
             menu += "</li> ";
             menu += "<li class='has-sub '> ";
             menu += "<a href='#'><span>Tables</span></a> ";
             menu += "<ul> ";
             menu += "<li class='has-sub '> ";
             menu += "<a href='../../../../../Visual/CRUD/Subtype/ListSubtype.aspx'><span>Subtypes</span></a> ";
             menu += "</li> ";
             menu += "<li class='has-sub '> ";
             menu += "<a href='../../../../../Visual/CRUD/Organism/ListOrganism.aspx'><span>Organisms</span></a> ";
             menu += "</li> ";
             menu += "<li class='has-sub '> ";
             menu += "<a href='../../../../../Visual/CRUD/User/ListUser.aspx'><span>Users</span></a>   ";
             menu += "</li> ";
             menu += "</ul> ";
             menu += "</li> ";
             menu += "<li> ";
             menu += "<a href='../../../../../Visual/About.aspx'><span>About</span></a> ";
             menu += "</li> ";
             menu += "<li class='has-sub '> ";
             menu += "<a href='#'><span>Configuration</span></a> ";
             menu += "<ul> ";
             menu += "<li class='has-sub '> ";
             menu += "<a href='../../../../../Visual/Configuration/GlobalConfiguration.aspx'><span>Global Configuration</span></a> ";
             menu += "</li> ";
             menu += "<li class='has-sub '> ";
             menu += "<a href='../../../../../Visual/Configuration/UserConfiguration.aspx'><span>User Configuration</span></a> ";
             menu += "</li> ";
             menu += "<li class='has-sub '> ";
             menu += "<a href='../../../../../Visual/CRUD/Plugins/ListPlugin.aspx'><span>Plug-ins</span></a> ";
             menu += "</li> ";
             menu += "</ul> ";
             menu += "<li class='has-sub '> ";
             menu += "<a href='#'><span>Account</span></a> ";
             menu += "<ul> ";
             menu += "<li class='has-sub '> ";
             menu += "<a href='../../../../../Visual/CRUD/Group/ListGroup.aspx'><span>Sample Groups</span></a>   ";
             menu += "</li> ";
             menu += "<li class='has-sub '> ";
             menu += "<a href='../../../../../Visual/Messages/inbox.aspx'><span>Messages</span></a>   ";
             menu += "</li> ";
             menu += "<li class='has-sub '> ";
             menu += "<a href='../../../../../Default.aspx'><span>Logout( " + usuariologado.login + " )</span></a>  ";
             menu += "</li> ";
             menu += "</ul> ";
             menu += "</li> ";
             menu += "</ul> ";
            return menu;

        }

        public static string getCurator(Code.dto.User usuariologado)
        {
            String menu = null;
            menu += "<ul> ";
            menu += "<li class='active '> ";
            menu += "<a href='../../../../../Buscador.aspx'><span>Home</span></a>  ";
            menu += "</li> ";
            menu += "<li class='has-sub '> ";
            menu += "<a href='#'><span>Procedures</span></a> ";
            menu += "<ul> ";
            menu += "<li class='has-sub '> ";
            menu += "<a href='../../../../../Visual/Procedures/Subtyping/SequenceSubtyping.aspx'><span>Sequence Subtyping</span></a> ";
            menu += "</li> ";
            menu += "<li class='has-sub '> ";
            menu += "<a href='../../../../../Visual/Procedures/Mapping/SequenceMapping.aspx'><span>Sequence Mapping</span></a> ";
            menu += "</li> ";
            menu += "<li class='has-sub '> ";
            menu += "<a href='../../../../../Visual/Procedures/Blast/BlastNTool.aspx'><span>Blast Tool</span></a> ";
            menu += "</li> ";
            menu += "<li class='has-sub '> ";
            menu += "<a href='../../../../../Visual/Procedures/Alignments/SequenceAlignment.aspx'><span>Sequence Alignment</span></a> ";
            menu += "</li> ";
            menu += "<li class='has-sub '> ";
            menu += "<a href='../../../../../Visual/CRUD/Sequence/ImportSequence.aspx'><span>Import Sequences</span></a> ";
            menu += "</li> ";
            menu += "<li class='has-sub '> ";
            menu += "<a href='../../../../../Visual/CRUD/Sequence/ImportGenBank.aspx'><span>Import From GenBank File</span></a> ";
            menu += "</li> ";
            menu += PluginsDAO.ListToItensmenu(PluginsDAO.DSToList(PluginsDAO.select("", "")));
            menu += "</ul> ";
            menu += "</li> ";
            menu += "<li class='has-sub '> ";
            menu += "<a href='#'><span>Reports</span></a> ";
            menu += "<ul> ";
            menu += "<li class='has-sub '> ";
            menu += "<a href='../../../../../Visual/Procedures/Reports/GeneralMapAndSubReport.aspx'><span>Mapping and Subtyping Report</span></a> ";
            menu += "</li> ";
            menu += "<li class='has-sub '> ";
            menu += "<a href='../../../../../Visual/Procedures/Reports/Sequence_map.aspx'><span>Sequence Map Report</span></a> ";
            menu += "</li> ";
            menu += "<li class='has-sub '> ";
            menu += "<a href='../../../../../Visual/Procedures/Reports/Sequence_subtype.aspx'><span>Sequence Subtyping Report</span></a> ";
            menu += "</li> ";
            menu += "<li class='has-sub '> ";
            menu += "<a href='../../../../../Visual/Procedures/Reports/UserReport.aspx'><span>User Report</span></a> ";
            menu += "</li> ";
            menu += "<li class='has-sub '> ";
            menu += "<a href='../../../../../Visual/Procedures/Reports/GroupReport.aspx'><span>Groups Report</span></a> ";
            menu += "</li> ";
            menu += "<li class='has-sub '> ";
            menu += "<a href='../../../../../Visual/Procedures/Reports/OrganismReport.aspx'><span>Organism Report</span></a> ";
            menu += "</li> ";
            menu += "<li class='has-sub '> ";
            menu += "<a href='../../../../../Visual/Procedures/Reports/SequencesReport.aspx'><span>Sequences Report</span></a> ";
            menu += "</li> ";
            menu += "</ul> ";
            menu += "</li> ";
            menu += "<li class='has-sub '> ";
            menu += "<a href='#'><span>Tables</span></a> ";
            menu += "<ul> ";
            menu += "<li class='has-sub '> ";
            menu += "<a href='../../../../../Visual/CRUD/Subtype/ListSubtype.aspx'><span>Subtypes</span></a> ";
            menu += "</li> ";
            menu += "<li class='has-sub '> ";
            menu += "<a href='../../../../../Visual/CRUD/Organism/ListOrganism.aspx'><span>Organisms</span></a> ";
            menu += "</li> ";
            menu += "</ul> ";
            menu += "</li> ";
            menu += "<li> ";
            menu += "<a href='../../../../../Visual/About.aspx'><span>About</span></a> ";
            menu += "</li> ";
            menu += "<li class='has-sub '> ";
            menu += "<a href='#'><span>Configuration</span></a> ";
            menu += "<ul> ";
          
            menu += "<li class='has-sub '> ";
            menu += "<a href='../../../../../Visual/Configuration/UserConfiguration.aspx'><span>User Configuration</span></a> ";
            menu += "</li> ";
            menu += "<li class='has-sub '> ";
            menu += "<a href='../../../../../Visual/CRUD/Plugins/ListPlugin.aspx'><span>Plug-ins</span></a> ";
            menu += "</li> ";
            menu += "</ul> ";
            menu += "<li class='has-sub '> ";
            menu += "<a href='#'><span>Account</span></a> ";
            menu += "<ul> ";
            menu += "<li class='has-sub '> ";
            menu += "<a href='../../../../../Visual/CRUD/Group/ListGroup.aspx'><span>Sample Groups</span></a>   ";
            menu += "</li> ";
            menu += "<li class='has-sub '> ";
            menu += "<a href='../../../../../Visual/Messages/inbox.aspx'><span>Messages</span></a>   ";
            menu += "</li> ";
            menu += "<li class='has-sub '> ";
            menu += "<a href='../../../../../Default.aspx'><span>Logout( " + usuariologado.login + " )</span></a>  ";
            menu += "</li> ";
            menu += "</ul> ";
            menu += "</li> ";
            menu += "</ul> ";

            return menu;

        }

        public static string getResearcher(Code.dto.User usuariologado)
        {
            String menu = null;

            menu += "<ul> ";
            menu += "<li class='active '> ";
            menu += "<a href='../../../../VSDBM/Buscador.aspx'><span>Home</span></a>  ";
            menu += "</li> ";
            menu += "<li class='has-sub '> ";
            menu += "<a href='#'><span>Procedures</span></a> ";
            menu += "<ul> ";
            menu += PluginsDAO.ListToItensmenu(PluginsDAO.DSToList(PluginsDAO.select("", "")));
            menu += "</ul> ";
            menu += "</li> ";
            menu += "<li class='has-sub '> ";
            menu += "<a href='#'><span>Reports</span></a> ";
            menu += "<ul> ";
            menu += "<li class='has-sub '> ";
            menu += "<a href='../../../../VSDBM/Visual/Procedures/Reports/GeneralMapAndSubReport.aspx'><span>Mapping and Subtyping Report</span></a> ";
            menu += "</li> ";
            menu += "<li class='has-sub '> ";
            menu += "<a href='../../../../VSDBM/Visual/Procedures/Reports/Sequence_map.aspx'><span>Sequence Map Report</span></a> ";
            menu += "</li> ";
            menu += "<li class='has-sub '> ";
            menu += "<a href='../../../../VSDBM/Visual/Procedures/Reports/Sequence_subtype.aspx'><span>Sequence Subtyping Report</span></a> ";
            menu += "</li> ";
            menu += "<li class='has-sub '> ";
            menu += "<a href='../../../../VSDBM/Visual/Procedures/Reports/UserReport.aspx'><span>User Report</span></a> ";
            menu += "</li> ";
            menu += "<li class='has-sub '> ";
            menu += "<a href='../../../../VSDBM/Visual/Procedures/Reports/GroupReport.aspx'><span>Groups Report</span></a> ";
            menu += "</li> ";
            menu += "<li class='has-sub '> ";
            menu += "<a href='../../../../VSDBM/Visual/Procedures/Reports/OrganismReport.aspx'><span>Organism Report</span></a> ";
            menu += "</li> ";
            menu += "<li class='has-sub '> ";
            menu += "<a href='../../../../VSDBM/Visual/Procedures/Reports/SequencesReport.aspx'><span>Sequences Report</span></a> ";
            menu += "</li> ";
            menu += "</ul> ";
            menu += "</li> ";
            menu += "<li> ";
            menu += "<a href='../../../../VSDBM/Visual/About.aspx'><span>About</span></a> ";
            menu += "</li> ";
            menu += "<li class='has-sub '> ";
            menu += "<a href='#'><span>Account</span></a> ";
            menu += "<ul> ";
            menu += "<li class='has-sub '> ";
            menu += "<a href='../../../../VSDBM/Visual/CRUD/Group/ListGroup.aspx'><span>Sample Groups</span></a>   ";
            menu += "</li> ";
            menu += "<li class='has-sub '> ";
            menu += "<a href='../../../../VSDBM/Visual/Messages/inbox.aspx'><span>Messages</span></a>   ";
            menu += "</li> ";
            menu += "<li class='has-sub '> ";
            menu += "<a href='../../../../VSDBM/Default.aspx'><span>Logout( " + usuariologado.login + " )</span></a>  ";
            menu += "</li> ";
            menu += "</ul> ";
            menu += "</li> ";
            menu += "</ul> ";

            return menu;

        }



         


    }
}